import { get, post, put } from '@/utils/request'

/**
 * 获取咨询列表
 * @returns {Promise<Array>}
 */
export function getConsultationList() {
  return get('/expert/consultation/list')
}

/**
 * 回复咨询
 * @param {Object} data - { id: number, reply: string }
 * @returns {Promise}
 */
export function replyConsultation(data) {
  // 转换为 URL 参数格式
  const params = new URLSearchParams()
  params.append('id', data.id)
  params.append('reply', data.reply)
  
  return post('/expert/consultation/reply', params, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 关闭咨询
 * @param {number} id - 咨询ID
 * @returns {Promise}
 */
export function closeConsultation(id) {
  return put(`/expert/consultation/close/${id}`)
} 